CREATE DATABASE Bank
go

USE Bank
go

CREATE TABLE Card
(
	CardNumber 	char(16) 	PRIMARY KEY,
	CardHolder 	varchar(30)	not null,
	ExpDate 	datetime	not null,
	Balance 	decimal(10,2)	not null
)
go

CREATE TABLE Payment
(
	OrderID 	int	primary key,
	CardNumber 	char(16)	not null,
	PaymentDate 	datetime	not null,
	TotalPrice		decimal(10,2)	not null,

	constraint FK_Payment_Card_CardNumber foreign key ([CardNumber]) references [dbo].[Card] ([CardNumber])
)
go

CREATE NONCLUSTERED INDEX [IX_Payment_CardNumber] ON [dbo].[Payment] 
(
	[CardNumber] ASC
)ON [PRIMARY]
GO

/* data for Card  */
INSERT INTO Card VALUES('1111111111111111','Nguyen Thi Thanh Sang',DATEADD(year,5,getdate()),5000000)
go

/* data for Payment  */
INSERT INTO Payment VALUES(1,'1111111111111111',getdate(),350000)
go